package com.sri.formBeans;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class LoginForm extends ActionForm {

  private String userName;

  private String password;

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  public LoginForm() {
    // TODO Auto-generated constructor stub
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    userName = null;
    password = null;
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    if (userName == null || userName.trim().equals("")) {
      errors.add("userName", new ActionError("userRegistration.firstName.problem"));
    }
    return errors;
  }
}
